<template lang="html">
  <div class="record">
    <div class="r-head">
      <img class="max" src="/static/new/free_get/results_img_ikon@2x.png" alt="">
    </div>
    <div class="list" v-if="list">
      <div class="item">
        <div class="tips">仪器兑换数量</div>
        <div class="flex-display">
          <div class="flex-num-one">
            <div class="num">{{ list.self_get_machine_count }}</div>
            <div class="title">自己购买兑换数量（台）</div>
          </div>
          <div class="flex-num-one">
            <div class="num">{{ list.sub_get_machine_count }}</div>
            <div class="title">自己购买兑换数量（台）</div>
          </div>
        </div>
      </div>
      <div class="item">
        <div class="tips">个人累计</div>
        <div class="flex-display">
          <div class="flex-num-one">
            <div class="num">{{ list.self_count }}</div>
            <div class="title">已购买总数量（盒）</div>
          </div>
          <div class="flex-num-one">
            <div class="num">{{ list.self_valid }}</div>
            <div class="title">有效兑换数量（盒）</div>
          </div>
        </div>
      </div>
      <div class="item">
        <div class="tips">下级累计</div>
        <div class="flex-display">
          <div class="flex-num-one">
            <div class="num">{{ list.sub_count }}</div>
            <div class="title">已购买总数量（盒）</div>
          </div>
          <div class="flex-num-one">
            <div class="num">{{ list.sub_valid }}</div>
            <div class="title">有效兑换数量（盒）</div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { getRecordCount } from '@/api/freeget'
export default {
  data() {
    return {
      list: null,
    }
  },
  created() {
    this.getRecordCount();
    document.title = '领取记录'
  },
  methods: {
    getRecordCount() {
      getRecordCount({
        uid: this.getUserInfo().id
      }).then((res)=>{
        this.list = res.data;
        console.log(res)
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.record{
  background: -webkit-linear-gradient(top, #0ca6fe 0%, #0390FF 100%);
  background: linear-gradient(to bottom, #0ca6fe 0%, #0390FF 100%);
  padding-bottom: .6rem;
  overflow: hidden;
  .r-head{
    text-align: center;
    width: 5rem;
    margin: 1rem auto;
  }
  .flex-num-one{
    text-align: center;
  }
  .item{
    background-color: #fff;
    margin: .4rem;
    margin-bottom: 0;
    padding: .6rem 0;
    border-radius: .2rem;
    position: relative;
    overflow: hidden;
    .tips{
      position: absolute;
      padding: .25rem;
      left: 0;
      top: .4rem;
      background-color: #3AD3FF;
      color: #fff;
      border-radius: 0 .6rem .6rem 0;
    }
    .flex-display{
      margin-top: 1.3rem;
    }
    .num{
      font-size: .7rem;
      color: #3AD3FF;
    }
    .title{
      color: #999999;
    }
    .flex-num-one:nth-child(1){
      position: relative;
      &::before{
        position: absolute;
        content: "";
        right: 0;
        top: .2rem;
        height: .9rem;
        width: 1px;
        background-color: #ddd;
      }
    }
  }
  .item:nth-child(2) .tips{
    background-color: #FFC03A;
  }
  .item:nth-child(2) .num{
    color: #FFC03A;
  }
  .item:nth-child(3) .tips{
    background-color: #FF6681;
  }
  .item:nth-child(3) .num{
    color: #FF6681;
  }
}
</style>
